﻿using System;

namespace DapperLambdaSQL.Model.Exceptions
{
    public class ExecuteSqlException : Exception
    {
        private readonly string message;
        private readonly Exception innerException;
        public override string Message => message;

        /// <summary>
        /// 执行SQL异常
        /// </summary>
        /// <param name="operation">操作</param>
        /// <param name="innerException">异常</param>
        public ExecuteSqlException(string operation, Exception innerException)
        {
            this.innerException = innerException;
            message = $"执行{operation}出现异常：{innerException.Message}";
        }

        public override Exception GetBaseException()
        {
            return innerException;
        }
    }
}